<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    {js href='/public/static/jquery/jquery-1.11.0.min.js' /}
    {js href='/public/static/layui/layui.js' /}
    {CSS href="/public/static/layui/css/layui.css" /}
    {CSS href="__ADDONSTATIC__/css/style.css" /}

</head>
<body>
<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
    <ul class="layui-tab-title">
        <a href="{:addonUrl('templet',['type'=>1])}"><li {if condition='$type == 1'} class="layui-this"{/if}>首页模板</li></a>
        <a href="{:addonUrl('templet',['type'=>2])}"><li {if condition='$type == 2'} class="layui-this"{/if}>栏目模板</li></a>
        <a href="{:addonUrl('templet',['type'=>3])}"><li {if condition='$type == 3'} class="layui-this"{/if}>详情模板</li></a>
    </ul>

    <div class="layui-tab-content">
        <div class="forms-content" style="padding-top: 10px;">

                {volist name='configList' id='vo'}
                    <div class="preview-list-wrap" >
                        <div class="preview-list">
                            <img src="__ADDONSTATIC__/{$vo.preview}" onclick="selectTemp('{$vo.code}')" />
                            <div class="img_layer" id="templet{$vo.code}" {if $vo.checked == 1} style="display: block;" {/if}>
                            </div>
                        </div>

                    </div>
                {/volist}

    </div>

</div>
<script>

    function selectTemp(code) {
        parent.layer.confirm('确定选择吗？', {
            btn: ['是','不'], //按钮
            offset: ['20%', '30%'],
            shade: 0.1,
        }, function(){
            $.post("",{code:code},function (res) {
                if(res.status==1){
                    $('.img_layer').hide();
                    $('#templet'+code).show();
                    parent.layer.alert(res.msg,function (index) {

                        parent.layer.close(index);
                    })
                }else{
                    parent.layer.alert(res.msg)
                }
            })
        }, function(){

        });
    }

</script>
</body>
</html>